/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.epsi.blokus.entity;

import org.newdawn.slick.Animation;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.SpriteSheet;
import org.newdawn.slick.state.StateBasedGame;

/**
 * Loader 
 * @author julien.lafont
 */
public class Loader implements IEntity {

    private Image source;
    private SpriteSheet sprite;
    private Animation animation;;

    private int x;
    private int y;

    public void init(GameContainer container, StateBasedGame game) throws SlickException {
        source = new Image("/res/Sprites/loading.png");
        sprite = new SpriteSheet(source, 128, 15);
        animation = new Animation(sprite, 500);
        animation.setAutoUpdate(false);
    }

    public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException {
        animation.update(delta);
    }

    public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException {
        animation.draw(x,y);
    }

    public void setPosition(int x, int y)
    {
        this.x = x;
        this.y = y;
    }

}
